﻿using System;
using System.Collections.Generic;
using System.Text;
using TarreOA.TarreOAModels;
using TarreOA.TarreOADAL;

namespace TarreOA.TarreOABLL
{
    public class DiscussThemetbService
    {
        /// <summary>
        /// 将讨论主题保存到数据库中
        /// </summary>
        /// <param name="dtTitle"></param>
        /// <param name="dtContent"></param>
        /// <param name="dtCreateTime"></param>
        /// <param name="uid"></param>
        /// <returns></returns>
        public int SaveDiscussThemeInfo(string dtTitle, string dtContent, DateTime dtCreateTime, int uid, int daid)
        {
            DiscussThemetbDAO dtDAO = new DiscussThemetbDAO();
            return dtDAO.SaveDiscussThemeInfo(dtTitle, dtContent, dtCreateTime, uid, daid);
        }

        /// <summary>
        /// 根据主题编号查找主题信息
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public DiscussThemetb FindById(int id)
        {
            DiscussThemetbDAO dtDAO = new DiscussThemetbDAO();
            return dtDAO.FindById(id);
        }

        /// <summary>
        /// 查找所有讨论主题
        /// </summary>
        /// <returns></returns>
        public List<DiscussThemetb> FindALL()
        {
            DiscussThemetbDAO dtDAO = new DiscussThemetbDAO();
            return dtDAO.FindALL();
        }

        /// <summary>
        /// 根据讨论分区编号查找该分区所有主题
        /// </summary>
        /// <param name="daid"></param>
        /// <returns></returns>
        public List<DiscussThemetb> findALLByDaId(int daid)
        {
            DiscussThemetbDAO dtDAO = new DiscussThemetbDAO();
            return dtDAO.findALLByDaId(daid);
        }

        /// <summary>
        /// 为主题增加人气
        /// </summary>
        /// <param name="dtid"></param>
        /// <returns></returns>
        public int UpdateThemeHot(int dtid)
        {
            DiscussThemetbDAO dtDAO = new DiscussThemetbDAO();
            return dtDAO.UpdateThemeHot(dtid);
        }

        /// <summary>
        /// 为主题增加回复数量
        /// </summary>
        /// <param name="dtid"></param>
        /// <returns></returns>
        public int UpdateThemeAppCount(int dtid)
        {
            DiscussThemetbDAO dtDAO = new DiscussThemetbDAO();
            return dtDAO.UpdateThemeAppCount(dtid);
        }

        /// <summary>
        /// 根据主题编号删除主题
        /// </summary>
        /// <param name="dtid"></param>
        /// <returns></returns>
        public int DelThemeById(int dtid)
        {
            DiscussThemetbDAO dtDAO = new DiscussThemetbDAO();
            return dtDAO.DelThemeById(dtid);
        }
    }
}
